package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.travel.model.WelfareConsumptionCouponDetail;
import com.eling.elcms.travel.service.IWelfareConsumptionCouponDetailManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@Controller
public class WelfareConsumptionCouponDetailController extends BaseFormController{
	@Autowired
	private IWelfareConsumptionCouponDetailManager welfareConsumptionCouponDetailManager;
	
	@RequestMapping("/api/welfareconsumptioncoupondetail/save")
	@ResponseBody
	public WelfareConsumptionCouponDetail save(@ModelAttribute WelfareConsumptionCouponDetail cond) {
		return welfareConsumptionCouponDetailManager.save(cond);
	}

	@RequestMapping("/api/welfareconsumptioncoupondetail/{pkWelfareConsumptionCouponDetail}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkWelfareConsumptionCouponDetail) {
		welfareConsumptionCouponDetailManager.remove(pkWelfareConsumptionCouponDetail);
		return new Msg("删除成功");
	}

	@RequestMapping("/api/welfareconsumptioncoupondetail/query")
	@ResponseBody
	public List<WelfareConsumptionCouponDetail> query(@ModelAttribute WelfareConsumptionCouponDetail cond) {
		return welfareConsumptionCouponDetailManager.query(cond);
	}

	@RequestMapping("/api/welfareconsumptioncoupondetail/search*")
	@ResponseBody
	public List<WelfareConsumptionCouponDetail> search(@ModelAttribute SearchCondition sc,
			@ModelAttribute WelfareConsumptionCouponDetail cond) {
		sc.setQueryCondition(cond);
		return welfareConsumptionCouponDetailManager.search(sc);
	}
	
}
